﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace FUSE
{
    public class ComponentTemplate
    {
        /*
         * p = planet
         * s = sun
         * w = wormhole
         * b = blackhole
         * a = asteroid
         */
        private char type;

        private float scale;
        private float componentRadius;
        private Vector2 position;
        private int mass;

        /*
         * 0 = crash radius
         * 1 = orbit radius
         * 2 = slingshot radius
         */
        private float[] ringRadiusList;

        public ComponentTemplate(char newType, float newScale, float newRadius, int xCoord, int yCoord)
        {
            this.type = newType;
            this.scale = newScale;
            this.componentRadius = newRadius;
            this.position = new Vector2(xCoord, yCoord);
            this.mass = 1; //needs magic formula to determine mass based upon size - looks_good f(x)

            this.ringRadiusList = new float[3];

            if (newType != 'p')
                ringRadiusList[1] = 0;
            else
                ringRadiusList[1] = (newRadius * (newScale * 0.50f)) + newRadius;

            if (newType != 'w')
                ringRadiusList[0] = (newRadius * (newScale * 0.30f)) + newRadius;
            else
                ringRadiusList[0] = 0;
            
            if ((newType != 'w') && (newType != 'a'))
                ringRadiusList[2] = 0;
            else
                ringRadiusList[2] = (newRadius * newScale) + newRadius;

        }

        public ComponentTemplate(char newType, float newScale, float newRadius, int xCoord, int yCoord, int newMass, float crashRadius,
            float orbitRadius, float slingShotRadius) 
        {
            this.type = newType;
            this.scale = newScale;
            this.componentRadius = newRadius;
            this.position = new Vector2(xCoord, yCoord);
            this.mass = newMass;

            this.ringRadiusList = new float[3];

            
            ringRadiusList[0] = crashRadius;
            ringRadiusList[1] = orbitRadius;
            ringRadiusList[2] = slingShotRadius;
        }

        public float Scale
        {
            get
            {
                return this.scale;
            }
            set
            {
                this.scale = value;
            }
        }

        public char Type
        {
            get
            {
                return this.type;
            }
            set
            {
                this.type = value;
            }
        }

        public float ComponentRadius
        {
            get
            {
                return this.componentRadius;
            }
            set
            {
                this.componentRadius = value;
            }
        }

        public Vector2 Position
        {
            get
            {
                return this.position;
            }
            set
            {
                this.position.X = value.X;
                this.position.Y = value.Y;
            }
        }

        public int Mass
        {
            get
            {
                return this.mass;
            }
            set
            {
                this.mass = value;
            }
        }

    }
}
